package com.vf.admin.client.dao;

import com.vf.admin.common.db.BaseDao;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppFamilySetLevel;
import com.vf.admin.utils.StringEx;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public class AppFamilySetLevelDao extends BaseDao<AppFamilySetLevel> {


    public AppFamilySetLevel getInfo(Integer id)
    {
        ArrayList<Object> list = new ArrayList<>();
        String sql = "select * from app_family_set_level where id=?";
        list.add(id);
        return this.queryObj(sql,list,AppFamilySetLevel.class);
    }


    public List<AppFamilySetLevel> getLevelList()
    {
        String sql = "select * from app_family_set_level where 1=1";
        ArrayList<Object> list = new ArrayList<>();
        return this.queryList(sql,list,AppFamilySetLevel.class);
    }

    public List<AppFamilySetLevel> getLevelList(SplitPageBean splitPageBean)
    {
        String sql = "select * from app_family_set_level where 1=1";
        ArrayList<Object> list = new ArrayList<>();
        return this.queryList(sql,list,AppFamilySetLevel.class,splitPageBean);
    }

    public AppFamilySetLevel getLevelInfoByLevel(Integer level)
    {
        String sql = "select * from app_family_set_level where level=?";
        ArrayList<Object> list = new ArrayList<>();
        list.add(level);
        return this.queryObj(sql,list,AppFamilySetLevel.class);
    }


    public void saveOrAddLevel(AppFamilySetLevel appFamilySetLevel)
    {
        if(!StringEx.isNullOrLing(appFamilySetLevel.getId())){
            this.update(appFamilySetLevel);
        }else{
            this.add(appFamilySetLevel);
        }
    }



}
